﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bussiness;

namespace WebApplication.Admin.Baocao
{
    public class BaoCaoNhapTheoThang
    {
        public IQueryable<BaoCaoNhapTheoTh> GetBaoCaoNhapTheoThang(int thang,int year,string ngayhthi,string mamathang)
        {
            DateTime dt = DateTime.Now;
            string dts = dt.ToString("MM");
            var db = dataprovider.Entity.CHITIETHOADONNHAPs;
            return db.Where(p => p.HOADONNHAP.NGAYNHAP.Value.Month==thang && p.HOADONNHAP.NGAYNHAP.Value.Year==year && p.MAMH==mamathang)
                .Select(p => new BaoCaoNhapTheoTh
                {
                    NhaCC = p.HOADONNHAP.NHACUNGCAP.TENNCC,
                    mahdn = p.MAHDN,
                    mathang = p.MATHANG.TENMH,
                    soluong = (int)p.SOLUONGNHAP,
                    dongia = (int)p.HOADONNHAP.DONGIA,
                    tongtien = (int)p.HOADONNHAP.TONGTIEN,
                    nhanvien = p.HOADONNHAP.NHANVIEN.TENNV,
                    tinhtrang = (bool)p.TINHTRANG,
                    ngay=ngayhthi,
                    donvitinh = p.MATHANG.DONVITINH.DONVITINH1
                });
        }
        public class BaoCaoNhapTheoTh
        {

            public string NhaCC { get; set; }
            public string mahdn { get; set; }
            public string mathang { get; set; }
            public int soluong { get; set; }
            public int dongia { get; set; }
            public int tongtien { get; set; }
            public string nhanvien { get; set; }
            public string ngay { get; set; }
            public bool tinhtrang { get; set; }
            public string donvitinh { get; set; }
        }
           
    }
}